/**
 * This script handles the set up of the index page by setting
 * up event handlers, animations, etc.
 *
 * @author nicholas malacarne <nicholas.malacarne@gmail.com>
 */

// load required scripts -nm
$.loadScript( "js/ajax/getInfo.ajax.js" );
$.loadScript( "js/filters/index.filter.js" );
$.loadScript( "js/anims/index.scroll.anim.js" );
$.loadScript( "js/anims/nav.fade.anim.js" );
$.loadScript( "js/events/logout.event.js" );


// execute when page ready -nm
$( document ).ready(function() {
    
    // load login/register or control panel -nm
    getInfo_ajax().done( index_filter );
    
    // attach fading navigation to window -nm
    $( window ).scroll( nav_fade_anim );
    
    // attach scroll event to 'learn more' link -nm
    $( "#calltoaction" ).on( "click", index_scroll_anim );
    $( "#downarrow" ).on( "click", index_scroll_anim );
    
    // attach log out event to 'log out' link -nm
    $( '#logout' ).on( 'click', logout_event );
});